package cn.udinghuo.model.archives.system;

import com.fasterxml.jackson.annotation.JsonSetter;

import org.springframework.util.Assert;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Column;
import cn.udinghuo.core.domain.entity.BaseEntity;	
import cn.udinghuo.model.archives.system.StatusType;	
import cn.udinghuo.core.domain.entity.Comment;
import cn.udinghuo.core.domain.entity.ita.CacheKey;

/**
 * @author yueyibo
 *	公共状态码
 */
@Entity
@Table(name="statuscode")
public class StatusCode extends BaseEntity<Long>  {

	private static final long serialVersionUID = -16777217L;
	/**
	* 区分审批状态/订单状态/付款状态等type
	*/
	@Comment(value="区分审批状态/订单状态/付款状态等")
	@Column(name="cType")
	private Short type;
	/**
	* 状态名name
	*/
	@Comment(value="状态名")
	@Column(name="cName")
	private String name;
	/**
	* 状态码code
	*/
	@Comment(value="状态码")
	@Column(name="cCode")
	private String code;
	/**
	* 描述memo
	*/
	@Comment(value="描述")
	@Column(name="cMemo")
	private String memo;
	/**
	* 排序order
	*/
	@Comment(value="排序")
	@Column(name="iOrder")
	private Integer order;
	/**
	* 是否可用enable
	*/
	@Comment(value="是否可用")
	@Column(name="bEnable")
	private Boolean enable;
	/**
	* 是否默认isDefault
	*/
	@Comment(value="是否默认")
	@Column(name="bDefault")
	private Boolean isDefault;
	public StatusType getType() {
        if(this.type == null){
			return null;
		}
		return StatusType.find(this.type.intValue());
	}
	@JsonSetter
	public void setType(StatusType value) {
		Assert.notNull(value, "enum value is invalid value!");
		this.type = value.getValue();
	}
	
	public void setType(Short value) {
		Assert.notNull(value,"enum value is invalid value!");
		Assert.notNull(StatusType.find(value.intValue()),"enum value is invalid value!"); 
		this.type = value;
	}
	
	public String getName() {
		return this.name;
	}
	
	public void setName(String value) {
		this.name = value;
	}
	
	public String getCode() {
		return this.code;
	}
	
	public void setCode(String value) {
		this.code = value;
	}
	
	public String getMemo() {
		return this.memo;
	}
	
	public void setMemo(String value) {
		this.memo = value;
	}
	
	public Integer getOrder() {
		return this.order;
	}
	
	public void setOrder(Integer value) {
		this.order = value;
	}
	
	public Boolean getEnable() {
		return this.enable;
	}
	
	public void setEnable(Boolean value) {
		this.enable = value;
	}
	
	public Boolean getIsDefault() {
		return this.isDefault;
	}
	
	public void setIsDefault(Boolean value) {
		this.isDefault = value;
	}
	
}
